package pattern.observer;

import java.util.Observable;
import java.util.Observer;

public class Phone implements Observer
{
	Observable weatherCenter;
	String message;
	public Phone(Observable observable)
	{
		weatherCenter = observable;
		weatherCenter.addObserver(this);
	}
	@Override
	public void update(Observable o, Object arg)
	{
		if(o instanceof WeatherCenter)
		{
			this.message = ((WeatherCenter) o).getMessage();
			System.out.println(arg);
		}
	}
	public void show()
	{
		System.out.println(message);
	}
	
	
}
